package muster;

import java.util.Objects;

/**
 * @author:Administrator
 * @date:2022/1/21
 * @describe:
 */
public class Student {
    private int id;
    public String name;
    public int age;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(int id, String name, int age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (o != null) {
            Student stu = (Student) o;
            return stu.hashCode() == this.hashCode();
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Integer.hashCode(this.id);
    }
}
